﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Empires.Infrastructure.Entities.Repository;

namespace Empires.Infrastructure.Entities.Entity
{
    public class SiteReference : IAccessible<T_SiteReference, SiteReference>, ILogicEntity<T_SiteReference, SiteReference>
    {
        public int Id { get; set; }
        /// <summary>
        /// 对应公司Id
        /// </summary>
        public int CopId { get; set; }
        /// <summary>
        /// 预设二级域名URL
        /// </summary>
        public string SetURL { get; set; }
        /// <summary>
        /// 独立购买域名
        /// </summary>
        public string SpecialURL { get; set; }

        protected override void Covariant(T_SiteReference model)
        {
            if (model != null)
            {
                this.Id = model.Id;
                this.CopId = model.CopId;
                this.SetURL = model.SetURL;
                this.SpecialURL = model.SpecialURL;
            }
        }

        protected override T_SiteReference Inverter(SiteReference model)
        {
            if (model != null)
            {
                return new T_SiteReference()
                {
                    CopId = model.CopId,
                    Id = model.Id,
                    SetURL = model.SetURL,
                    SpecialURL = model.SpecialURL
                };
            }
            return null;
        }

        public SiteReference Set(T_SiteReference dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}